"""
用for循环实现1~100求和

"""

sum = 0
for x in range(1, 101):
    sum += x
print(sum)

# 用for循环实现1~100之间的偶数求和
sum = 0
for x in range(2, 101, 2):
    sum += x
print(sum)

sum = 0
num = 1
while num <= 100:
    sum += num
    num += 1
print(sum)

sum, num = 0, 2
while num <= 100:
    sum += num
    num += 2
print(sum)
